home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / pcshell.arc / PC-SHELL.DOC next >
Encoding:
Text File  |  1986-05-27  |  43.7 KB  |  1,122 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  69.  
  70.  
  71.  
  72.           NAME    
  73.           NAME  
  74.  
  75.  
  76.                pc-shell - pc command processor 
  77.  
  78.  
  79.           SYNOPSIS    
  80.           SYNOPSIS  
  81.  
  82.  
  83.                pc shell                              
  84.                pc-shell  [-s] [-v] [arg1 ... argn] 
  85.  
  86.  
  87.           DESCRIPTION    
  88.           DESCRIPTION  
  89.  
  90.  
  91.                pc-shell is a command processor for IBM-PC's and compatibles that 
  92.                emulates  some  of  the  more desirable functions of the Berkeley
  93.                UNIX* C-shell. In addition, it implements PC-DOS versions of some 
  94.                of the common UNIX* commands - ls, mv, cp, etc.  
  95.  
  96.  
  97.                     s                                                              
  98.                The -s option causes the program execute a file called "shell.rc" 
  99.                in the  current directory before passing control to the user.  If 
  100.                "shell.rc" is not found in the current directory,  the  directory
  101.                specified by the environment string "HOME" will be searched.  
  102.  
  103.  
  104.                      v                                                            
  105.                The  -v  option (verbose) causes the program to echo all commands
  106.                to the standard error stream before executing them.  
  107.  
  108.  
  109.                arg1     argn                                                      
  110.                arg1 ... argn (the command  line  arguments)  are  put  into  the
  111.                shell's environment as the variables $1 through $n.  
  112.  
  113.  
  114.  
  115.           Wild Card Substitution    
  116.           Wild Card Substitution  
  117.  
  118.  
  119.                Ambiguous  file  names  are  expanded  to a list of matching file
  120.                names on the command line.  This can be defeated by quoting,  and
  121.                by setting the NOGLOB environment variable to '1'.  
  122.  
  123.  
  124.                Command  lines  passed  to external programs are truncated to 128
  125.                characters.  
  126.  
  127.  
  128.  
  129.           History Substitution    
  130.           History Substitution  
  131.  
  132.  
  133.  
  134.                History substitution is a powerful means to save retyping of long 
  135.                command lines.It allows you to do things like re-execute the last 
  136.                command, re-execute the last command but  redirect  output  to  a
  137.                file,  or  execute  a  new  command  with arguments from previous
  138.                command lines.  The last  20  commands  are  saved,  and  can  be
  139.                reviewed by typing the 'history' command.  
  140.  
  141.  
  142.                Previous commands can be referred to by their number, or relative 
  143.                to the  current  command's  number.    Parameters  from  previous
  144.                commands can be seperated out and used individually.  
  145.  
  146.  
  147.                History substitutions specifications come  in  two  parts  -  the
  148.                command  number   specifier and the argument specifier, seperated
  149.                by a colon.  The argument    specifier  is  optional;  if  it  is
  150.                omitted, the entire command line is specified.  
  151.  
  152.  
  153.                <command specifier> ::= !! | !n | !-n 
  154.                !!  = last command
  155.  
  156.  
  157.  
  158.                                               -1-
  159.  
  160.  
  161.  
  162.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  163.  
  164.  
  165.  
  166.                !n  = nth command
  167.                !-n = command n commands before current command number
  168.                !#  = the current command line
  169.  
  170.  
  171.                <arg specifier> ::= :[^$*] | :n | :n* | <empty>
  172.                n   = number of argument (0 being the command name)
  173.                ^   = first argument (i.e. argv[1])
  174.                $   = last argument
  175.                *   = ^-$, or nothing if only one word on command line
  176.                n*  = arguments n through $
  177.  
  178.  
  179.                <history subst specification> ::= <command specifier><arg specifier>
  180.  
  181.  
  182.                This is  not  as  complicatated  as  it  may  appear.  Here is an
  183.                example session.  
  184.  
  185.  
  186.                EXAMPLE 
  187.  
  188.  
  189.                0% ls *.c
  190.                *.c
  191.                foo.c bar.c
  192.                1% more foo.c
  193.                /* edit the last argument of the last command */
  194.                2% edit !!:$            
  195.                /* go off and edit */
  196.                /* reference last argument of last command */
  197.                3% fgrep foo !!:$ bar.c 
  198.                FOO.C : foo
  199.                BAR.C : foo
  200.                /* edit the second thru the last args of command 3 */
  201.                4% edit !3:2*            
  202.                (go off and edit)
  203.                /* repeat last command */
  204.                %5 !!
  205.                (go off and edit)
  206.                /* remove the 1st argument of the command 2 before the current one */
  207.                %6 rm !-6:^
  208.  
  209.  
  210.                History substitution here is a compatible subset of the [U|XE]NIX 
  211.                C shell  history  substitution  facility.    Cshell  allows  even
  212.                weirder combinations.  
  213.  
  214.  
  215.  
  216.           Variable Substitution    
  217.           Variable Substitution  
  218.  
  219.  
  220.  
  221.                Shell  variables are synonymous for our purposes with environment
  222.                strings, i.e.  they are defined with the 'set' command.  
  223.  
  224.  
  225.                Variables are referenced on  the  command  line  by  prefacing  a
  226.                variable name  by  a  dollar  sign.    Two  dollar signs in a row
  227.                signify a dollar sign character.  
  228.  
  229.  
  230.                As mentioned above, command line arguments are contained  in  the
  231.                                                      n                             
  232.                shell variables, $1 through $n, where n is the number of the last 
  233.                argument.  
  234.  
  235.  
  236.                EXAMPLE
  237.  
  238.  
  239.  
  240.                                               -2-
  241.  
  242.  
  243.  
  244.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  245.  
  246.  
  247.  
  248.                %0 set home = c:/
  249.                %1 echo $home
  250.                C:/
  251.                %2 ls $home
  252.                C:/*.*
  253.                command.com
  254.                %3 echo $path
  255.                C:/bin
  256.  
  257.  
  258.                And so on.  
  259.  
  260.  
  261.  
  262.           Special variables    
  263.           Special variables  
  264.  
  265.  
  266.                There  are  a some shell variables that have special meanings for
  267.                                                              set                  
  268.                the shell.  They can be given values with the set command.   They
  269.                are 
  270.  
  271.  
  272.               NOCLOBBER    
  273.               NOCLOBBER  
  274.  
  275.  
  276.                        NOCLOBBER                                                  
  277.                    If  NOCLOBBER is equal to '1', then existing files may not be
  278.                    destroyed by output  redirection,  and  output  files  to  be
  279.                    appended to by >> must exist.  
  280.  
  281.  
  282.  
  283.               PROMPT    
  284.               PROMPT  
  285.  
  286.  
  287.                         PROMPT                                                    
  288.                    The  PROMPT  environment string is handled the same way as it
  289.                          COMMAND COM                                              
  290.                    is by COMMAND.COM.  There  is  one  pc-shell-specific  prompt
  291.                    string character  !    that  specifies  the  current  command
  292.                    index.  If no PROMPT environment string is defined, then  the
  293.                    default is '$!% '.  
  294.  
  295.  
  296.           NOGLOB    
  297.           NOGLOB  
  298.  
  299.  
  300.                     NOGLOB                                                        
  301.                The  NOGLOB environment string, if set to '1', will suppress file
  302.                name expansion.  
  303.  
  304.  
  305.  
  306.           Multiple commands on one command line    
  307.           Multiple commands on one command line  
  308.  
  309.  
  310.                Command lines are split at semicolons.  This can be  defeated  by
  311.                quoting or escaping.  
  312.  
  313.  
  314.                EXAMPLE 
  315.  
  316.  
  317.                %0 ls -l *.c ; make shell.exe ; exit
  318.  
  319.  
  320.           Conditional command execution    
  321.           Conditional command execution  
  322.  
  323.  
  324.                If  two  commands  are seperated by '&&', then the second will be
  325.                executed only if the first returns 0 as an exit  code.    If  two
  326.                commands  are seperated by '||', then the second will be executed
  327.                only the first command returns non-zero as an exit code.  
  328.  
  329.  
  330.                Example 
  331.  
  332.  
  333.                    make shell.exe && chmod +w /bin/shell.exe && mv shell.exe /bin 
  334.  
  335.  
  336.  
  337.                                               -3-
  338.  
  339.  
  340.  
  341.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  342.  
  343.  
  344.  
  345.                    If the make operation fails, then the chmod and the  mv  will
  346.                    not be executed.  
  347.  
  348.  
  349.                    make shell.exe || echo You blew it bub!
  350.  
  351.  
  352.                    If  the make operation fails, then the echo operation will be
  353.                    executed.  
  354.  
  355.  
  356.  
  357.           Character Escapes  Shell Comments  and Argument Quoting    
  358.           Character Escapes, Shell Comments, and Argument Quoting  
  359.  
  360.  
  361.                Any character preceded by a  \ (backslash) is  copied  unmodified
  362.                to the  command  buffer.  This allows you to suppress the special
  363.                meanings of shell command characters, such as '|',  ';',  and  '*
  364.                '.  
  365.  
  366.  
  367.                # is  the  shell comment character.  Anything on a line after a #
  368.                character is ignored.  
  369.  
  370.  
  371.                Command line arguments contained in quotes (single or double) may 
  372.                contain blank space (i.e. blanks or tabs).  Variable substitution 
  373.                will take place within strings surrounded by double quotes.    No
  374.                interpretation takes place within single quotes.   
  375.  
  376.  
  377.                Within   double   quotes,   the  'C'  language  escape  sequences
  378.                \r,\n,\b,\f, and \a are honored - i.e.  they are mapped to  their
  379.                corresponding control characters.  
  380.  
  381.  
  382.  
  383.           Startup and Script Files    
  384.           Startup and Script Files  
  385.  
  386.  
  387.  
  388.                If  '-s'  is  specified on the command line the program will look
  389.                for a file called SHELL.RC in the current directory, and  execute
  390.                it before  passing    control to the console.  This allows you to
  391.                set up all your alias commands.  It isn't a good idea to  put  an
  392.                'exit'   command  in  your  SHELL.RC  file,  as  the  shell  will
  393.                terminate.  
  394.  
  395.  
  396.                                             sh                                    
  397.                Any file whose extension is .sh is run as a command  file.    The
  398.                environment  string  PATH is used to locate the script file if it
  399.                isn't in the current directory.  .sp 1 There is  also  a  command
  400.                sh                                                                 
  401.                sh,  into  which  shell scripts whose extension is not .sh can be
  402.                redirected as standard input.  
  403.  
  404.  
  405.                EXAMPLE
  406.  
  407.  
  408.                %0 sh <batch.fil        # use the sh command
  409.                %1 shell <batch.fil     # run the external program
  410.  
  411.  
  412.  
  413.           INPUT OUTPUT    
  414.           INPUT/OUTPUT  
  415.  
  416.  
  417.                                                          COMMAND COM              
  418.                I/O redirection operates as it does under COMMAND.COM  with  some
  419.                additional options: 
  420.  
  421.  
  422.             name   
  423.            <name 
  424.  
  425.  
  426.  
  427.  
  428.                                               -4-
  429.  
  430.  
  431.  
  432.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  433.  
  434.  
  435.  
  436.                               name                           
  437.                Opens the file name as the standard input.  
  438.  
  439.  
  440.              word   
  441.            <<word 
  442.  
  443.  
  444.                                                                            word   
  445.                reads  the  shell  input up to a line which is identical to word.
  446.                The resulting text is put into an anonymous temporary file, which 
  447.                is given to the command as standard input.  
  448.  
  449.  
  450.                 name  
  451.                >name
  452.                  name  
  453.                >!name
  454.                  name  
  455.                >&name
  456.                   name  
  457.                >&!name
  458.  
  459.  
  460.                             name                                                  
  461.                    The file name  is used as standard output.    If  it  doesn't
  462.                    exist,  it's  created; if it exists, it is truncated, and its
  463.                    previous contents are lost.  
  464.  
  465.  
  466.                                    NOCLOBBER                                      
  467.                    If the variable NOCLOBBER is set, the file must  not  already
  468.                    exist, or  an  error results.  The forms using an exclamation
  469.                    point override the NOCLOBBER variable's action.  
  470.  
  471.  
  472.                               name                                                
  473.                    The form >&name routes standard  error  along  with  standard
  474.                              name     
  475.                    output to name.  
  476.  
  477.  
  478.                  name  
  479.                >>name
  480.                   name  
  481.                >>!name
  482.                   name  
  483.                >>&name
  484.                    name  
  485.                >>&!name
  486.  
  487.  
  488.                                     name                                          
  489.                    Uses  the  file  name  as standard output, like >, but places
  490.                                                                NOCLOBBER           
  491.                    output at the end of file.  If the variable NOCLOBBER is set, 
  492.                    it is an error if the file doesn't already exist.  The  forms
  493.                    using  an exclamation point override the NOCLOBBER variable's
  494.                    action.  
  495.  
  496.  
  497.  
  498.               BUILT IN COMMANDS    
  499.               BUILT-IN COMMANDS  
  500.  
  501.  
  502.  
  503.                    Some of the internal commands are  UNIX*  style  replacements
  504.                    for  COMMAND.COM internal commands, and some are included for
  505.                    convenience.  
  506.  
  507.  
  508.                        Output of the 'commands' command
  509.  
  510.  
  511.                        a:              alias           b:              c:
  512.                        cat             cd              chdir           chmod
  513.                        cls             commands        copy            cp
  514.                        d:              del             dir             dump
  515.                        e:              echo            era             erase
  516.                        error           exit            f:              fgrep
  517.                        g:              h:              hd              history
  518.                        i:              j:              ls              md
  519.                        mkdir           mon             more            mv
  520.                        popd            pushd           pwd             rd
  521.                        read            rm              rmdir           set
  522.                        sh              switchar        tee             touch
  523.                        unalias         version         y
  524.  
  525.  
  526.  
  527.                                               -5-
  528.  
  529.  
  530.  
  531.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  532.  
  533.  
  534.  
  535.                    There are many that are simply aliases, e.g.  'copy' and 'cp' 
  536.                    invoke the same program.  
  537.  
  538.  
  539.  
  540.               COMMAND DESCRIPTION SYNTAX    
  541.               COMMAND DESCRIPTION SYNTAX  
  542.  
  543.  
  544.                    terms used in syntax explanations :
  545.                    
  546.                    fname ::= PC-DOS ambiguous or unambiguous file or directory name.
  547.                    
  548.                    uname ::= unambiguous PC-DOS file or directory name
  549.                    
  550.                    string ::= any string of printable characters of arbitrary(<512) length.
  551.                    
  552.                    filelist ::= filename [filename .. filename]
  553.                    
  554.                    noargs ::= no arguments at all
  555.                    
  556.                    space ::= any white space characters
  557.                    
  558.                    [arg] ::= term is optional
  559.                    
  560.                    envstring ::=    <string>=<string> | <string><space>=<space><string> |
  561.                 <string><space><string>
  562.  
  563.  
  564.  
  565.               COMMANDS    
  566.               COMMANDS  
  567.  
  568.  
  569.  
  570.                    drive  
  571.                    drive
  572.  
  573.  
  574.                        a: | b: | c: | d: | e: | f: | g: | h: | i: | j: <noargs> 
  575.  
  576.  
  577.                        changes default drive.  If you don't have such  a  drive,
  578.                        nothing happens.  
  579.  
  580.  
  581.                    alias  
  582.                    alias
  583.  
  584.  
  585.                        alias <envstring> 
  586.  
  587.  
  588.                        assigns cmdstring  to name.  name can now be used just as
  589.                        if it were a built-in or external command.  cmdstring may 
  590.                        contain history expressions or variable substitutions.  
  591.  
  592.  
  593.                        The syntax of this command is flexible - you can  specify
  594.                        alii  (?)  in  the form 'name=subst','name subst','name =
  595.                        subst', or  'name  =subst.'  However  you  need  a  space
  596.                                   before                                          
  597.                        character  before  a  single quote in order to specify an
  598.                        alias that contains blanks.  
  599.  
  600.  
  601.                            alias     set                                          
  602.                        The alias and set commands  are  case  sensitive,  unlike
  603.                                         COMMAND COM     
  604.                        their analogs in COMMAND.COM.  
  605.  
  606.  
  607.                    cat  
  608.                    cat
  609.  
  610.  
  611.                        cat [<filelist>] 
  612.  
  613.  
  614.                        copies specified  files  to standard output.  If none are
  615.  
  616.  
  617.  
  618.                                               -6-
  619.  
  620.  
  621.  
  622.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  623.  
  624.  
  625.  
  626.                        given, copies standard input to standard output 
  627.  
  628.  
  629.                    cp  
  630.                    cp
  631.  
  632.  
  633.                        cp | copy <filelist> <uname> 
  634.  
  635.  
  636.                        copies specified files to destination file or device.  If 
  637.                        more than one file is in the file list, <uname> must be a 
  638.                        directory.  
  639.  
  640.  
  641.                    cd  
  642.                    cd
  643.  
  644.  
  645.                        cd | chdir <dirname> 
  646.  
  647.  
  648.                        makes <dirname> the current default directory.  
  649.  
  650.  
  651.                    chmod  
  652.                    chmod
  653.  
  654.  
  655.                        chmod [-|+[arwhs]*] <filelist> 
  656.  
  657.  
  658.                        change file permissions for specified files 
  659.  
  660.  
  661.                        +r, -r turn on or off read permission - i.e. hide the file.
  662.                        +w, -w turn on or off write permission.
  663.                        +h, -h turn on or off hidden attribute - converse of r
  664.                        +a, -a turn on or off archive attribute
  665.                        +s, -s turns on or off the system attribute
  666.  
  667.  
  668.                        Note that '-r'  or  '+rwh'  are  both  valid  syntax  for
  669.                        switches.   Also  new permission switches are permissable
  670.                        between file names with the following  warning:  I  don't
  671.                        reset the masks between file names - if you have a second 
  672.                        batch  of  attribute  changes  on  the  command line, the
  673.                        effect is additive.  If you're  not  careful,  you  could
  674.                        make a mess of a files attributes.  
  675.  
  676.  
  677.                        If   you  don't  specify  any  attribute  switches,  file
  678.                        attributes will be set to 0, which  means  read,write,not
  679.                        hidden,not system, not  modified since last backup.  
  680.  
  681.  
  682.                    cls  
  683.                    cls
  684.  
  685.  
  686.                        cls <noargs> 
  687.  
  688.  
  689.                        clears the screen and homes the cursor.  
  690.  
  691.  
  692.                    commands  
  693.                    commands
  694.  
  695.  
  696.                        commands <noargs> 
  697.  
  698.  
  699.                        prints a  table  of  available  built-in  commands.  (see
  700.                        above) 
  701.  
  702.  
  703.                    del  
  704.                    del
  705.  
  706.  
  707.                        del 
  708.  
  709.  
  710.                        synonym for rm.  
  711.  
  712.  
  713.  
  714.                                               -7-
  715.  
  716.  
  717.  
  718.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  719.  
  720.  
  721.  
  722.                    dir  
  723.                    dir
  724.  
  725.  
  726.                        dir 
  727.  
  728.  
  729.                        synonym for ls.  
  730.  
  731.  
  732.                    dirs  
  733.                    dirs
  734.  
  735.  
  736.                        dirs <noargs> 
  737.  
  738.  
  739.                        lists the directories on the directory stack.  (see pushd 
  740.                        and popd) 
  741.  
  742.  
  743.                    du  
  744.                    du
  745.  
  746.  
  747.                        du [drivename] 
  748.  
  749.  
  750.                                                             drivename             
  751.                        prints out remaining space on drive  drivename.   If  you
  752.                        leave  off  the  drivename,  it  defaults  to the current
  753.                        drive.  
  754.  
  755.  
  756.                    dump  
  757.                    dump
  758.  
  759.  
  760.  
  761.                        dump filespec [block [page]] | [segment:[offset]] [count] 
  762.  
  763.  
  764.                        Where a block is 64K bytes and a page is 256 bytes
  765.                        Segment:offset are standard 8086 notation in hexadecimal
  766.                        Count is the number of bytes to dump in decimal
  767.  
  768.  
  769.                        This came from some anonymous public domain source, ported by me
  770.  
  771.  
  772.                    echo  
  773.                    echo
  774.  
  775.  
  776.                        echo <anything> 
  777.  
  778.  
  779.                                                            echo  on               
  780.                        echos argument list  to  screen.    echo  on  causes  all
  781.                        commands  to  be  echoed  before execution (i.e. sets the
  782.                                         echo off                                
  783.                        verbose  flag).  echo off turns off the verbose flag.  
  784.  
  785.  
  786.                    era  
  787.                    era
  788.  
  789.  
  790.                        era 
  791.  
  792.  
  793.                        synonym for rm.  
  794.  
  795.  
  796.                    error  
  797.                    error
  798.  
  799.  
  800.                        error <noargs> 
  801.  
  802.  
  803.                        prints returned value of last command to the screen.  
  804.  
  805.  
  806.                    exit  
  807.                    exit
  808.  
  809.  
  810.                        exit <noargs> 
  811.  
  812.  
  813.                        terminates execution of the currently running  sub-shell.
  814.                        If  you are at top level of execution, you will return to
  815.  
  816.  
  817.  
  818.                                               -8-
  819.  
  820.  
  821.  
  822.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  823.  
  824.  
  825.  
  826.                        dos.  
  827.  
  828.  
  829.                    fgrep  
  830.                    fgrep
  831.  
  832.  
  833.                        fgrep <pattern> <filelist> 
  834.  
  835.  
  836.                        looks for unambiguous pattern  <pattern>  in  <filelist>.
  837.                        echos lines matching to the screen.  
  838.  
  839.  
  840.                    history  
  841.                    history
  842.  
  843.  
  844.                        history [size] 
  845.  
  846.  
  847.                                                                          size     
  848.                        prints history  list  to  standard  output.    If size is
  849.                        given, the number of commands history remembers is set to 
  850.                        size                                                       
  851.                        size.  If you change  the  size,  history  'forgets'  all
  852.                        previous commands and resets its counters to 0.  
  853.  
  854.  
  855.                    ls  
  856.                    ls
  857.  
  858.  
  859.                        ls | dir [-[alqctrR]] <filelist> 
  860.  
  861.  
  862.                        Lists files that match <filelist> 
  863.  
  864.  
  865.                        -a all files, including system files are listed.  '.' and 
  866.                        '..'  are  suppressed,  but you know they're there if you
  867.                        need them, don't you?  
  868.                        -l prints out file times, permissions, etc 
  869.                        -q suppresses header line from display - useful when  you
  870.                        want to pipe stuff into another program.  
  871.                        -c print as one column.  
  872.                        -t sort by time, most recent last 
  873.                        -R recurse through all encountered subdirectories.  
  874.                        -r reverses sort order.  
  875.  
  876.  
  877.                    md  
  878.                    md
  879.  
  880.  
  881.                        md | mkdir <uname> 
  882.  
  883.  
  884.                        make a directory.  Prints an error if it can't be done 
  885.  
  886.  
  887.                    mon  
  888.                    mon
  889.  
  890.  
  891.                        mon <noargs> 
  892.  
  893.  
  894.                        mon                                                         
  895.                        mon prints to standard error a lot of cryptic information 
  896.                        on system variables thusly: 
  897.  
  898.  
  899.                            Corg : 0000 Cend : 715a Dorg : 0002 Dend 167a
  900.                            Uorg : 167a Uend : 327a mbot : 427c mtop 4800
  901.                            sbot : 0000 PSP  : 490d STKSIZ : 00256 HEAPSIZ : 00064
  902.                            dsval : 5033 csval : 491d
  903.                            STKLOW : 0001 MEMRY : 4680
  904.                            CS : 491d DS : 5033 SP : 4186
  905.  
  906.  
  907.                        You  can  probably  figure out what most of the variables
  908.                        mean.  If you have source and have broken the shell, this 
  909.                        command may help.  
  910.  
  911.  
  912.  
  913.                                               -9-
  914.  
  915.  
  916.  
  917.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  918.  
  919.  
  920.  
  921.                    more  
  922.                    more
  923.  
  924.  
  925.                        more [-[0-9]*] [<filelist>] 
  926.  
  927.  
  928.                        List file to screen with pauses 
  929.  
  930.  
  931.                        -n specify tab width when expanding tabs, where n  is  an
  932.                        integer.   more acts like 'cat' when redirected - you can
  933.                        concatenate files in  this  manner.    If  no  files  are
  934.                        specifed, standard input is 'mored.' 
  935.  
  936.  
  937.                    mv  
  938.                    mv
  939.  
  940.  
  941.                        mv [-v] <filelist> <uname> 
  942.  
  943.  
  944.                        moves  specified  file  or  files  to  target specifed by
  945.                        <uname>.  If there is more than one file in list, <uname> 
  946.                        must be a directory 
  947.  
  948.  
  949.                         v                                                         
  950.                        -v  will  print  out  a  message   saying   how   it   is
  951.                        accomplishing   the   move,   which   is   probably  more
  952.                        interesting to me than you.  
  953.  
  954.  
  955.                    popd  
  956.                    popd
  957.  
  958.  
  959.                        popd <noargs> 
  960.  
  961.  
  962.                        returns to directory at top of directory stack.  
  963.  
  964.  
  965.                    pushd  
  966.                    pushd
  967.  
  968.  
  969.                        pushd <uname> 
  970.  
  971.  
  972.                        save current working directory on  directory  stack,  and
  973.                        changes current working directory to <uname>.  
  974.  
  975.  
  976.                    pwd  
  977.                    pwd
  978.  
  979.  
  980.                        pwd 
  981.  
  982.  
  983.                        prints current working directory to standard output.  
  984.  
  985.  
  986.                    read  
  987.                    read
  988.  
  989.  
  990.                        read vname0 [vname1 .. vnamen] 
  991.  
  992.  
  993.                        read                                                       
  994.                        read  reads  a line from standard input, and assigns each
  995.                        word from  the  line  to  the  corresponding  environment
  996.                                               vname0          vnamen     
  997.                        variable specified by  vname0  through vnamen.  
  998.  
  999.  
  1000.                        EXAMPLE 
  1001.  
  1002.  
  1003.                            read a b    # read into environment variables a and b
  1004.                        you type
  1005.                            hello there
  1006.                            echo $a
  1007.                        the shell echos
  1008.                            hello
  1009.  
  1010.  
  1011.  
  1012.                                              -10-
  1013.  
  1014.  
  1015.  
  1016.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1017.  
  1018.  
  1019.  
  1020.                            echo $b
  1021.                        there
  1022.  
  1023.  
  1024.                        If there are fewer environment variables specified on the 
  1025.                        command  line  than  there are words in the command line,
  1026.                        the last environment variable will contain  the  rest  of
  1027.                        the words on the line.  
  1028.  
  1029.  
  1030.                        EXAMPLE 
  1031.  
  1032.  
  1033.                            read a b    # read into environment variables a and b
  1034.                        you type
  1035.                            hello there Mister Jones
  1036.                            echo $a
  1037.                        the shell echos
  1038.                            hello
  1039.                            echo $b
  1040.                        there Mister Jones
  1041.  
  1042.  
  1043.                        If  there  are  more environment variables on the command
  1044.                        line than words on the line read from standard input, the 
  1045.                        left-over environment variables' state will not change  -
  1046.                        if  they  were  defined in the environment already, their
  1047.                        status won't change, and if they  weren't  defined,  they
  1048.                        stay undefined.  
  1049.  
  1050.  
  1051.                    rd  
  1052.                    rd
  1053.  
  1054.  
  1055.                        rd | rmdir <uname> 
  1056.  
  1057.  
  1058.                        remove specified directory if possible.  
  1059.  
  1060.  
  1061.                    rm  
  1062.                    rm
  1063.  
  1064.  
  1065.                        rm [-q] <filelist> 
  1066.  
  1067.  
  1068.                        blows  away  all files in <filelist>. If -q is specified,
  1069.                        will ask if they should be removed.  
  1070.  
  1071.  
  1072.                    set  
  1073.                    set
  1074.  
  1075.  
  1076.                        set [<envstring>] 
  1077.  
  1078.  
  1079.                        sets a string in the environment.  If you specify 'name=' 
  1080.                        with  no  string  after,  it  will  remove  it  from  the
  1081.                        environment.   If  you don't specify a string, set prints
  1082.                        out current environment.  
  1083.  
  1084.  
  1085.                        The syntax of this command is flexible - you can  specify
  1086.                        set  in  the  form 'set name=subst','set name subst','set
  1087.                        name = subst', or 'set name =subst.' However you  need  a
  1088.                                        before                                      
  1089.                        space character before a single quote in order to specify 
  1090.                        a substitution string that contains blanks.  
  1091.  
  1092.  
  1093.                    sh  
  1094.                    sh
  1095.  
  1096.  
  1097.                        sh [ <arg1> .. <argn>] <scriptfile 
  1098.  
  1099.  
  1100.  
  1101.  
  1102.                                              -11-
  1103.  
  1104.  
  1105.  
  1106.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1107.  
  1108.  
  1109.  
  1110.                        forks a  'local'  shell  -  i.e.    saves  all  pertinent
  1111.                        information about  the  shell  you're  currently  in  and
  1112.                        invokes  the command processor function recursively, with
  1113.                        scriptfile                                                 
  1114.                        scriptfile as input.  The  arguments  are  copied  to  $1
  1115.                        through  $N  environment strings, overwriting the startup
  1116.                        arguments.  
  1117.  
  1118.  
  1119.                        sh                                                         
  1120.                        sh gives you a way to run  scripts,  without  loading  an
  1121.                        extra copy of shell.com or small.com.  
  1122.  
  1123.  
  1124.                    switchar  
  1125.                    switchar
  1126.  
  1127.  
  1128.                        switchar [schar] 
  1129.  
  1130.  
  1131.                                                          schar      schar         
  1132.                        sets the  DOS switch character to schar.  If schar is not
  1133.                        given, the current switch character is echoed.  
  1134.  
  1135.  
  1136.                    tee  
  1137.                    tee
  1138.  
  1139.  
  1140.                        tee <uname> 
  1141.  
  1142.  
  1143.                        Copies standard input to standard  output,  depositing  a
  1144.                        copy in <uname> 
  1145.  
  1146.  
  1147.                    touch  
  1148.                    touch
  1149.  
  1150.  
  1151.                        touch <filelist> 
  1152.  
  1153.  
  1154.                        Makes  the  modification  time  of  specified  files  the
  1155.                        current date and time.  
  1156.  
  1157.  
  1158.                    unalias  
  1159.                    unalias
  1160.  
  1161.  
  1162.                        unalias aliasname 
  1163.  
  1164.  
  1165.                        remove alias name from the alias list.  
  1166.  
  1167.  
  1168.                    y  
  1169.                    y
  1170.  
  1171.  
  1172.                        y <filelist> 
  1173.  
  1174.  
  1175.                        copies standard input to standard output, and then copies 
  1176.                        the specified files to standard  output.    Sort  of  the
  1177.                        opposite of tee, in other words.  
  1178.  
  1179.  
  1180.  
  1181.               The Small Shell    
  1182.               The Small Shell  
  1183.  
  1184.  
  1185.  
  1186.                    Included  in release 2.0 or later is a 'small' version of the
  1187.                    shell.   This version will take up less than 30K of memory at 
  1188.                     runtime (as verified by chkdsk).  What's the catch?    Well,
  1189.                    ls,  cp,  mv, more, fgrep, and dump become external commands.
  1190.                    I am not going to distribute these commands; you  can  either
  1191.                    make  them    yourself,  or  you can use whatever you have on
  1192.                    hand.  If you need to use the COMMAND.COM copy facility,  try
  1193.                    putting these commands in your SHELL.RC file 
  1194.  
  1195.  
  1196.  
  1197.  
  1198.                                              -12-
  1199.  
  1200.  
  1201.  
  1202.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1203.  
  1204.  
  1205.  
  1206.                    alias cp 'command -c copy'
  1207.                    alias ls 'command -c dir -w | sort'
  1208.  
  1209.  
  1210.                    The   removed   commands   accounted  for  over  10K  of  the
  1211.                    shell.com.  
  1212.  
  1213.  
  1214.               Helpful hints    
  1215.               Helpful hints  
  1216.  
  1217.  
  1218.  
  1219.                    Use forward slashes in all path names.  (See  note  below  on
  1220.                    switch  characters)    If  you  use  DOS  3.0 or higher, this
  1221.                    includes paths to transient programs.  
  1222.  
  1223.  
  1224.                    put single quotes around arguments with semicolons  in  them,
  1225.                    so they don't turn into command delimiters.  
  1226.  
  1227.  
  1228.                    The  set  command affects only the local shell's environment.
  1229.                    You can 'exit' to command.com and the original environment is 
  1230.                    intact.  The  local  environment  is  2K  large  -  which  is
  1231.                    useful.  
  1232.  
  1233.  
  1234.                    When  using  the  Microsoft  C  compiler  under pc-shell, the
  1235.                    compiler has a bad habit of  look  for  parameters  beginning
  1236.                    with forward  slashes  in  the environment.  If you get their
  1237.                    famous  'P0  :  bad  option'  message,   try   revising   the
  1238.                    environment.  
  1239.  
  1240.  
  1241.  
  1242.               Implementation notes    
  1243.               Implementation notes  
  1244.  
  1245.  
  1246.  
  1247.                    DOS  doesn't  acknowledge  a  'change  default drive' command
  1248.                    until you issue a 'get current directory' call.   Why?    The
  1249.                    only way I figured this out is by disassembling command.com.  
  1250.  
  1251.  
  1252.                    PC|MS-DOS has  a  limit  of  20  file  handles.  If you add a
  1253.                    command that opens files, make sure you catch the  ctrl-break
  1254.                    signal and close them.  Look at CAT.C or Y.C for examples.  
  1255.  
  1256.  
  1257.                    DON'T  REDIRECT  INPUT  INTO  PRINT. Print gets all hosed up.
  1258.                    Print has lots of trouble in general with the  pc-shell,  and
  1259.                    should be avoided.  
  1260.  
  1261.  
  1262.               BUGS    
  1263.               BUGS  
  1264.  
  1265.  
  1266.  
  1267.                    Due  to  the way that environment strings are expanded on the
  1268.                    command line, semicolons inside  shell  variables  look  like
  1269.                    command seperators.    If  you enclose them in double quotes,
  1270.                    the problem will go away.  
  1271.  
  1272.  
  1273.                    I have noticed intermittent problems running on an  AT,  with
  1274.                    DOS  3.0,  but  have been unable to reproduce them on a PC. I
  1275.                    suspect bugs in DOS 3.0 that are absent in 3.1. If you notice 
  1276.                    any consistent problems, send  me a bug report.  
  1277.  
  1278.  
  1279.               HISTORY    
  1280.               HISTORY  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.                                              -13-
  1286.  
  1287.  
  1288.  
  1289.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1290.  
  1291.  
  1292.  
  1293.                   V 2 0    
  1294.                   V 2.0  
  1295.  
  1296.  
  1297.                        Minor bug fixes.  Started allocating command buffers  out
  1298.                        of heap rather than stack, reducing stack usage.  Stopped 
  1299.                        releasing source with executables.  
  1300.  
  1301.  
  1302.                   V 2 1    
  1303.                   V 2.1  
  1304.  
  1305.  
  1306.                        Fixed the bug that made "mv foo .." throw away the source 
  1307.                        file and  move  it to "..foo", (i.e. nowhere).  Added the
  1308.                        sh command,  that  allows  you  to  run  scripts  without
  1309.                        re-invoking the shell.  
  1310.  
  1311.  
  1312.                   V 2 2    
  1313.                   V 2.2  
  1314.  
  1315.  
  1316.                        Fixed  the bug that locked pc up when a command line with
  1317.                        a leading ; was entered.  Changed fork code so that files 
  1318.                        with the extension .sh are run as scripts.    The  equals
  1319.                        sign in alias and set is now optional.  
  1320.  
  1321.  
  1322.                   V 2 3    
  1323.                   V 2.3  
  1324.  
  1325.  
  1326.                        Removed  information  about versions 1.0 through 1.6 from
  1327.                        documentation, adding any relevant material to  the  tips
  1328.                        or implementation  notes sections.   Added redirection of
  1329.                        standard error, and checking for  NOCLOBBER.  Implemented
  1330.                        execution of the prompt string.  
  1331.  
  1332.  
  1333.  
  1334.                   V 2 4    
  1335.                   V 2.4  
  1336.  
  1337.  
  1338.                        The  problem running external programs written by IBM and
  1339.                        Microsoft  has  finally  been  traced  to  Aztecs  fexecv
  1340.                        function.   When  is  an  ASCIIZ  string  not  an  ASCIIZ
  1341.                        string?  When you need to put a single carriage return on 
  1342.                        the end of it.  THANKS to Programmers Journal. NOTE  WELL
  1343.                        that  needing  a carriage return in your command tail for
  1344.                        EXEC calls is note documented in the IBM PC-DOS technical 
  1345.                        reference.  
  1346.  
  1347.  
  1348.                        All references to the  Aztec  screen  library  have  been
  1349.                        removed,  so  this  should  work  on Rainbows, Compupros,
  1350.                        AMPROs etc.  etc.  etc.  ls is slower, but  its  a  small
  1351.                        price to  pay.    If  you want a fast version, one can be
  1352.                        created for you if you mail a contribution (hint,hint).  
  1353.  
  1354.  
  1355.                        mv now will do the right thing when you try to move to  a
  1356.                        drive  that  has been joined to a directory (DOS 3.1). It
  1357.                        also now has a  verbose  switch,  which  tells  you  what
  1358.                        exactly its doing.  When I started writing a mv, I had no 
  1359.                        idea  how  many  special  cases I would have to take care
  1360.                        of.  
  1361.  
  1362.  
  1363.                   V 2 5    
  1364.                   V 2.5  
  1365.  
  1366.  
  1367.                        Problem with using the wrong path to search for  external
  1368.                        programs solved.    Main  command line parsing changed so
  1369.                        that  NOGLOB  could  be  used  to  suppress   file   name
  1370.  
  1371.  
  1372.  
  1373.                                              -14-
  1374.  
  1375.  
  1376.  
  1377.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1378.  
  1379.  
  1380.  
  1381.                        expansion.  
  1382.  
  1383.  
  1384.                   V 2 6    
  1385.                   V 2.6  
  1386.  
  1387.  
  1388.                        Many stupid  bugs  in 2.5 are addressed (sorry folks).  I
  1389.                        now peek inside double quotes to do  variable  expansion.
  1390.                        Double quotes are now stripped.  
  1391.  
  1392.  
  1393.                   V 2 7    
  1394.                   V 2.7  
  1395.  
  1396.  
  1397.                        Added read.    Fixed  bug  in  ls that would occasionally
  1398.                        leave you in a different directory.    The  exit  command
  1399.                        will  now  just  pop  you out a level of shell execution,
  1400.                        rather than kicking you out to the DOS prompt.  
  1401.  
  1402.  
  1403.                   V 2 8    
  1404.                   V 2.8  
  1405.  
  1406.  
  1407.                        Fixed bug  in  more  that  made  it  puke  when  you  hit
  1408.                        <CTRL>-<BREAK> at the bottom of a screen-full.  Made move 
  1409.                        and  cp  preserve  file  times when they have to create a
  1410.                        target.  
  1411.  
  1412.  
  1413.                   V 2 9    
  1414.                   V 2.9  
  1415.  
  1416.  
  1417.                        Fixed bug in ls that caused it to get confused  when  you
  1418.                        did an  'ls  -R'  on  a  drive other than default.  Also,
  1419.                        stopped it from hanging on an empty pipe.  Added the 'du' 
  1420.                        command - which is simply the last line of ls  -l.  Shell
  1421.                        scripts will now be searched for on PATH.  
  1422.  
  1423.  
  1424.  
  1425.                   DONATIONS REQUESTED    
  1426.                   DONATIONS REQUESTED  
  1427.  
  1428.  
  1429.  
  1430.                        The shell seems to have generated an incredible amount of 
  1431.                        interest, all around the country - someone apparently put 
  1432.                        this code out over the usenet and arpanet, in addition to 
  1433.                        its original FIDOnet roots.  
  1434.  
  1435.  
  1436.                        I  would  like  to  keep  working  on  it,  but for it to
  1437.                        progress further, it can  no  longer  be  a  'lunch  hour
  1438.                        hack.' I am therefore requesting that those who feel that 
  1439.                        this  is a useful piece of software send me a donation to
  1440.                        further my efforts towards purchasing a machine for  home
  1441.                        use.  
  1442.  
  1443.  
  1444.                        Anyone  sending  more  that 25$ will recieve: 1. a PC-DOS
  1445.                        disk with most recent release full source and  executable
  1446.                        image.  2. Source and executable for various other public 
  1447.                        domain  *nix  programs  (tail,  nroff,  cut, paste, diff,
  1448.                        grep) 
  1449.  
  1450.  
  1451.                        If you use this every day, or if you are giving  everyone
  1452.                        in   your   place   of   employment   a  copy,  value  it
  1453.                        accordingly.  
  1454.  
  1455.  
  1456.                        This does not constitute a  licensing  agreement  of  any
  1457.                        sort, nor  is any warranty implied.  Once you have a copy
  1458.  
  1459.  
  1460.  
  1461.                                              -15-
  1462.  
  1463.  
  1464.  
  1465.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1466.  
  1467.  
  1468.  
  1469.                        of this program or its source,  it's  yours  to  hack  to
  1470.                        pieces, use,  revere,  revile,  or  whatever.  I like the
  1471.                        anarchic aspects of the various public domain networks.  
  1472.  
  1473.  
  1474.                        QUESTIONS COMMENTS BUGREPORTS GOTO 
  1475.                        KENT WILLIAMS
  1476.                        722 Rundell St.
  1477.                        Iowa City, IA 52240
  1478.                        (319) 338-6053 (HOME VOICE)
  1479.                        
  1480.                        * UNIX is an unregistered trademark of AT&T.
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.                                              -16-
  1532.  
  1533.  
  1534.